function removeCookie(key, ops = {}){
    ops.expires = -1;
    setCookie(key, null, ops);
}

function getCookie(key){
    const arr = document.cookie.split("; ");
    for(let i=0;i<arr.length;i++){
        if(arr[i].split("=")[0] === key){
            return arr[i].split("=")[1];
        }
    }
    return null;
}

function setCookie(key, value, ops={}){
    let str = "";
    if(ops.expires){
        const d = new Date;
        d.setDate(d.getDate() + ops.expires);
        str = ";expires="+d;
    }
    let p = ops.path ? ";path=" + ops.path : "";
    document.cookie = `${key}=${value}${str}${p}`;
}